<template>
	<view class="page-slidebar">
		<view class="sidebar-content">
			<view class="sidebar-item" @tap="gotab" data-id="1" data-urls="/pages/index/index">
				首页
			</view>
			<view v-for="item in sidebarlist" class="sidebar-item" :data-urls="item.url" @tap="gotab">
				{{item.typename}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				sidebarlist: [{
						url: '/pages/product/product',
						typename: '生产能力',
						typeid: '1'
					},
					{
						url: '/pages/news/news',
						typename: '新闻列表',
						typeid: '1'
					},
					{
						url: '/pages/about/about',
						typename: '联系我们',
						typeid: '1'
					}
				]
			}
		},
		onLoad() {

		},
		methods: {
			gotab: function(e) {
				console.log(e.currentTarget.dataset)
				let {
					urls
				} = e.currentTarget.dataset
				uni.switchTab({
					url: urls,
					success: function(e) {
					   
					},
					fail: (err) => {
						console.log('跳转失败', err)
					}
				})
			},

		}
	}
</script>

<style lang="scss">
	.sidebar-content {
		padding: 4vw 0;
		padding-right: 40%;

		.sidebar-item {
			font-size: 3.8vw;
			padding: 3vw 0;
			text-align: center;
			color: #666;
			border-bottom: 1px solid #efefef;
		}
	}
</style>
